package demo.api.trustsign;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import util.HttpClientUtil;

public class UserFind {
	
	private static String appKey = "cAwut4VATycNMq17NZeFUD63pe83l2OJ";
    private static String appSecrty = "3BAlrfr7lW8kwlCMfo1dXS8Syn5q5qjS";
    private static String baseUrl = "http://smp-test.szitrus.com.cn/smp-api";
    private static String api = "/api/trustsign/user/find";

	public static void main(String[] args) throws IOException {
		String url = baseUrl.concat(api);
	    // 请求参数
	    Map<String, String> params = new HashMap<>();
	    params.put("name", "张达山");
	    params.put("identity_type", "IdentityCard");
	    params.put("identification_number", "110101199003077432");
	    String resStr =  HttpClientUtil.getResponse(url, params, appKey, appSecrty);
	    JSONObject resJson = JSON.parseObject(resStr);
	    System.out.println(resJson);
	    System.out.println("用户ID【user_id】:"+resJson.getJSONObject("data").getString("user_id"));
	    System.out.println("印章ID【seal_id】:"+resJson.getJSONObject("data").getString("seal_id"));
	    System.out.println("证书序列号【cert_serialnumber】:"+resJson.getJSONObject("data").getString("cert_serialnumber"));
	    System.out.println("证书开始时间【cert_notbefore】:"+resJson.getJSONObject("data").getString("cert_notbefore"));
	    System.out.println("证书结束时间【cert_notafter】:"+resJson.getJSONObject("data").getString("cert_notafter"));
	    System.out.println("证书主题【cert_subject】:"+resJson.getJSONObject("data").getString("cert_subject"));
	}
}
